package dao;


import openConn.DruidUtils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class KeyDao {
        public static List<String> checkKey() throws SQLException {
            Connection connection = DruidUtils.openConn();
            String sql = "select key_name from key_info";
            PreparedStatement statement = connection.prepareStatement(sql);
            ResultSet resultSet = statement.executeQuery();
            List<String> stringList = new ArrayList<>();
            while (resultSet.next()){
                String str = resultSet.getString("key_name");
                stringList.add(str);
            }
            resultSet.close();
            statement.close();
            connection.close();
            return stringList;
        }
}